#ifndef __COMPATIBLE_H__
#define __COMPATIBLE_H__

#include "Dload.h"
#include "PacFile.h"

/*
const char* STATE_FILE_PATH = "/sdcard/modem_download_state";
const char* STATE_DOWNLOADING_STR = "Downloading";
const char* STATE_SUCCESS_STR = "Success";
const char* STATE_FAILED_STR = "Failed";
*/
#define STATE_FILE_PATH "/sdcard/modem_download_state"
#define STATE_DOWNLOADING_STR "Downloading"
#define STATE_SUCCESS_STR "Success"
#define STATE_FAILED_STR "Failed"

typedef BOOL (* _Download)(UINT nAddress, long pFileInfo);
typedef BOOL (* _DownloadFDL)(UINT nAddress,long pFileInfo);
typedef BOOL (* _DownloadFDL2)(UINT nAddress,long pFileInfo);
typedef BOOL (* _DownloadFile)(UINT nAddress,long pFileInfo);
typedef BOOL (* _DownloadNV)(UINT nAddress,long pFileInfo);
typedef int  (* _WriteCom)(char *buffer, int len);
typedef int  (* _Unpacket)(char* lpszReleaseDirPath,BIN_PACKET_HEADER_T* bph,FILE_T ** ppFileArray);

#define MODEM_TYPE_NONE  0
#define MODEM_TYPE_M1190 1
#define MODEM_TYPE_M7281 2
#define MODEM_TYPE_M0282 3 

struct DownloadCallback {
	int modem_type;
	_Download onDownload;
	_DownloadFDL onDownloadFDL;
	_DownloadFDL2 onDownloadFDL2;
	_DownloadFile onDownloadFile;
	_DownloadNV onDownloadNV;
	_WriteCom onWriteCom;
	_Unpacket onUnpacket;
};
struct DownloadCallback mDownloadCallback;
int write_status_file(const char* file, const char* state, const char* info);

#endif
